package com.jy.oms.framework.asyn.task.model;

import com.jy.oms.framework.asyn.task.constants.TaskQueueTypeEnum;

/**
 * 队列任务配置信息
 */
public class TaskConfig {

    /**
     * 任务队列
     */
    private TaskQueueTypeEnum taskQueue;

    /**
     * 重试次数
     */
    private int retryNum;

    /**
     * 是否连续重试
     */
    private boolean retryContinuous;
    
    private boolean retryBackoff;

    /**
     * 重试间隔时间
     */
    private int retryIntervalSeconds;

    /**
     * 异常发生且任务支持重试时，是否允许修改任务参数 便于 下一次执行使用
     */
    private boolean updateTaskParamWhenException;

    /**
     * 根据任务编码+任务参数保证任务唯一性，即相同的任务参数只会存在一条任务
     */
    private boolean keepUniqueTaskAccordParam;

    public TaskQueueTypeEnum getTaskQueue() {
        return taskQueue;
    }

    public TaskConfig setTaskQueue(TaskQueueTypeEnum taskQueue) {
        this.taskQueue = taskQueue;
        return this;
    }

    public Integer getRetryNum() {
        return retryNum;
    }

    public TaskConfig setRetryNum(Integer retryNum) {
        this.retryNum = retryNum;
        return this;
    }

    public TaskConfig setRetryNum(int retryNum) {
        this.retryNum = retryNum;
        return this;
    }

    public boolean isRetryContinuous() {
        return retryContinuous;
    }

    public TaskConfig setRetryContinuous(boolean retryContinuous) {
        this.retryContinuous = retryContinuous;
        return this;
    }

    public int getRetryIntervalSeconds() {
        return retryIntervalSeconds;
    }

    public TaskConfig setRetryIntervalSeconds(int retryIntervalSeconds) {
        this.retryIntervalSeconds = retryIntervalSeconds;
        return this;
    }

    public boolean isUpdateTaskParamWhenException() {
        return updateTaskParamWhenException;
    }

    public TaskConfig setUpdateTaskParamWhenException(boolean updateTaskParamWhenException) {
        this.updateTaskParamWhenException = updateTaskParamWhenException;
        return this;
    }

    public boolean isKeepUniqueTaskAccordParam() {
        return keepUniqueTaskAccordParam;
    }

    public TaskConfig setKeepUniqueTaskAccordParam(boolean keepUniqueTaskAccordParam) {
        this.keepUniqueTaskAccordParam = keepUniqueTaskAccordParam;
        return this;
    }

    public boolean isRetryBackoff() {
        return retryBackoff;
    }

    public TaskConfig setRetryBackoff(boolean retryBackoff) {
        this.retryBackoff = retryBackoff;
        return this;
    }
}
